package no21.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class CachedThreadPool {
	public static void main(String[] args) {
		//从它的实现可以看出  返回的是  ThreadPoolExecutor
		ExecutorService exec = Executors.newCachedThreadPool();
		for (int i = 0; i < 5; i++) {
			exec.execute(new Liftoff());
		}
		//启动一次顺序关闭，执行以前提交的任务，但不接受新任务
		exec.shutdown();
	}
}	
